<?php

	class service {
		
		private $__dependances = array();


		public function __construct($service_name = null){
			if ($service_name){
				context::register_service($service_name, $this);
			}
		}
		
		final public function is_service(){
			return true;
		}
		
		private function get_service_name(){
			return get_class($this);
		}
		
		public function get_service_alias(){
			return $this->get_project_name()."__".get_class($this);
		}
		
		private function get_project_name(){
			//get project name there
		}
		
		
		
		//run install script
		public function install(){
			
		}
		
		private function depend_db_table($table_name){
			if (context::get("db")->query("SHOW TABLES LIKE {$table_name}")->rowCount()){
				return true;
			}
			return false;
		}
		
		private function depend_file($filename){
			return is_file($filename);
		}
		
		private function depend_permission($path, $permission = 0777){
			if (file_perms($path) >= $permission){
				return true;
			}else{
				return false;
			}
		}
		
		public function depend_on($type="none",$condition = null){
			$this->__dependances[$type] = $condition;
		}

	}


?>
